[Panel]
Title=%rsLocationTime
HidenTimer=0
NumToolbar1=6
toolbar1_0=43;TimeDec
toolbar1_1=44;TimeInc
toolbar1_2=84;TimeReset
toolbar1_3=88;Animation
toolbar1_4=103;TimeValPanel
toolbar1_5=104;TimeU
NumToolbar2=8
toolbar2_0=45;SetupTime
toolbar2_1=85;SetupObservatory
toolbar2_2=75;Calendar
toolbar2_3=108;ViewClock
toolbar2_4=38;toN
toolbar2_5=37;toE
toolbar2_6=39;toS
toolbar2_7=40;toW
NumComponent=26
component_0="Group_1;Time;2"
component_1="	Edit_1"
component_2="	Edit_2"
component_3="	Button_7;Calendar"
component_4="	Button_4;Now"
component_5="	Button_1;Apply"
component_6="	Event_0;0;Initalisation;"
component_7="	Event_1;1;Activation;"
component_8="	Event_4;4;Chart refresh;"
component_9="	Event_5;5;Object identification click;"
component_10="	Event_9;9;Translation;"
component_11="Group_3;Observatory;2"
component_12="	Edit_3"
component_13="	Edit_4"
component_14="	Edit_5"
component_15="	Edit_6"
component_16="	Edit_7"
component_17="	Combo_1;"
component_18="Group_5;Observatory list;1"
component_19="	List_1;90"
component_20="	Button_3;Apply"
component_21="Group_6;;2"
component_22="	Button_5;Save"
component_23="	Button_6;Load"
component_24="Group_2;Info;1"
component_25="	Memo_1;200"

[button_7]
s="var jd: double;"
"begin"
"  StrtoJD(Edit_1.Text,jd);"
"  if CalendarDialog(jd) then begin"
"     Edit_1.Text:=JDToStr(jd);"
"  end;"
"end."


[button_4]
s="// Set current time"
"begin"
"  MenuTimeReset.click;"
"end."


[button_1]
s="// Set date/time"
"var str: string;"
"    cm: Tstringlist;"
"begin"
" str:=trim(Edit_1.Text)+'T'+trim(Edit_2.Text);"
" GetSL('STRL1',cm);"
" cm.clear;"
" cm.add('SETDATE');"
" cm.add(str);"
" str:=cmd('',cm);"
" if pos('OK!',str)=0 then memo_1.lines.add('Error:'+str);"
" cm.clear;"
"end."


[button_3]
s="// Set observatory"
"var str,obs,lat,lon,alt,tz: string;"
"    p: integer;"
"    cm: Tstringlist;"
"begin"
"if List_1.itemindex>=0 then begin"
"  // split the parameters from the selected row"
"  str:=List_1.items[List_1.itemindex];"
"  p:=pos('=',str);"
"  obs:=copy(str,1,p-1);"
"  delete(str,1,p);"
"  p:=pos(';',str);"
"  lat:=copy(str,1,p-1);"
"  delete(str,1,p);"
"  p:=pos(';',str);"
"  lon:=copy(str,1,p-1);"
"  delete(str,1,p);"
"  p:=pos(';',str);"
"  alt:=copy(str,1,p-1);"
"  delete(str,1,p);"
"  tz:=str;"
"  // format the command and set observatory"
"  str:='LAT:'+trim(lat)+'LON:'+trim(lon);"
"  str:=str+'ALT:'+trim(alt)+'OBS:'+trim(obs)"
"  GetSL('STRL1',cm);"
"  cm.clear;"
"  cm.add('SETOBS');"
"  cm.add(str);"
"  str:=cmd('',cm);"
"  if pos('OK!',str)=0 then memo_1.lines.add('Error:'+str);"
"  // set the timezone"
"  cm.clear;"
"  cm.add('SETTZ');"
"  cm.add(trim(tz));"
"  str:=cmd('',cm);"
"  if pos('OK!',str)=0 then memo_1.lines.add('Error:'+str);"
"  cm.clear;"
"  Combo_1.text:='';"
"end;"
"end."


[button_5]
s="// save the observatory list to file"
"var fn: string;"
"begin"
" if SaveDialog(fn) then begin"
"    List_1.items.savetofile(fn);"
" end;"
"end."


[button_6]
s="// load the observatory list from file"
"var fn: string;"
"begin"
" if OpenDialog(fn) then begin"
"    List_1.items.loadfromfile(fn);"
" end;"
"end."


[combo_1]
s="// Select and set timezone"
"var cm: TStringList;"
"    str: string;"
"begin"
"  GetSL('STRL1',cm);"
"  cm.clear;"
"  cm.clear;"
"  cm.add('SETTZ');"
"  cm.add(trim(combo_1.text));"
"  str:=cmd('',cm);"
"  if pos('OK!',str)=0 then memo_1.lines.add('Error:'+str);"
"  cm.clear;"
"end."


[event_0]
s="// Initialization"
"var cm: Tstringlist;"
"    i: integer;"
"begin"
" // set properties"
" Memo_1.wordwrap:=false;"
" Combo_1.Style:=csDropDownList;"
" Edit_3.readonly:=true;"
" Edit_4.readonly:=true;"
" Edit_5.readonly:=true;"
" Edit_6.readonly:=true;"
" Edit_7.readonly:=true;"
" // fill UTC timezone"
" Combo_1.Clear;"
" for i:=0 to 11 do Combo_1.items.add('UTC'+inttostr(i-12));"
" Combo_1.items.add('UTC');"
" for i:=1 to 12 do Combo_1.items.add('UTC+'+inttostr(i));"
" // fill observatory list"
" GetSL('STRL1',cm);"
" cm.clear;"
" GetObservatoryList(cm);"
" List_1.Items.assign(cm);"
" cm.clear;"
" // add a few interesting location"
" List_1.items.add('Alexandria=31d12m00s;-29d55m00s;0m;UTC+2');"
" List_1.items.add('Babylon=32d32m11s;-44d25m15s;200m;UTC+3');"
" List_1.items.add('Samarkand=39d42m00s;-66d59m00s;700m;UTC+4');"
" List_1.items.add('Tikal=17d13m20s;89d37m25s;200m;UTC-6');"
"end."


[event_1]
s="// Activation event"
"var str: string;"
"    cm: Tstringlist;"
"    p: integer;"
"begin"
"// get chart date"
" GetSL('STRL1',cm);"
" cm.clear;"
" cm.add('GETDATE');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   p:=pos('T',str);"
"   Edit_1.Text:=copy(str,1,p-1);"
"   delete(str,1,p);"
"   Edit_2.Text:=str;"
" end;"
" cm.clear;"
"// get chart observatory"
" cm.add('GETOBS');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   p:=pos('LAT:',str);"
"   delete(str,1,p+3);"
"   p:=pos('LON:',str);"
"   Edit_3.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   p:=pos('ALT:',str);"
"   Edit_4.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   p:=pos('OBS:',str);"
"   Edit_5.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   Edit_6.Text:=str;"
" end;"
"// get timezone"
" cm.clear;"
" cm.add('GETTZ');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   Edit_7.text:=str;"
" end;"
" cm.clear;"
"end."


[event_4]
s="// Chart refresh event"
"var str: string;"
"    cm: Tstringlist;"
"    p: integer;"
"begin"
"// get chart date"
" GetSL('STRL1',cm);"
" cm.clear;"
" cm.add('GETDATE');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   p:=pos('T',str);"
"   Edit_1.Text:=copy(str,1,p-1);"
"   delete(str,1,p);"
"   Edit_2.Text:=str;"
" end;"
" cm.clear;"
"// get chart observatory"
" cm.add('GETOBS');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   p:=pos('LAT:',str);"
"   delete(str,1,p+3);"
"   p:=pos('LON:',str);"
"   Edit_3.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   p:=pos('ALT:',str);"
"   Edit_4.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   p:=pos('OBS:',str);"
"   Edit_5.Text:=copy(str,1,p-1);"
"   delete(str,1,p+3);"
"   Edit_6.Text:=str;"
" end;"
"// get timezone"
" cm.clear;"
" cm.add('GETTZ');"
" str:=cmd('',cm);"
" p:=pos('OK!',str);"
" if p>0 then begin"
"   delete(str,1,p+2);"
"   Edit_7.text:=str;"
" end;"
" cm.clear;"
"end."


[event_5]
s="// Object identification event"
"var longstr: string;"
"begin"
"// Info about object"
" getS('DescriptionText',longstr)"
" memo_1.clear;"
" memo_1.text:=longstr;"
" memo_1.selstart:=0;"
"end."


[event_9]
s=" // translation"
" begin"
"  group_1.caption:=rsDateTime;"
"  button_7.caption:=rsCalendar;"
"  button_4.caption:=rsNow;"
"  button_1.caption:=rsApply;"
"  group_3.caption:=rsObservatory;"
"  group_5.caption:=rsFavorite;"
"  button_3.caption:=rsApply;"
"  button_5.caption:=rsSave;"
"  button_6.caption:=rsLoad;"
"  group_2.caption:=rsInfo;"
" end."

